#include "TCommand.h"
#include "TUtils.h"
#include "TCommandParser.h"

UNSIGNED8 TCommand::fillFistPart(UNSIGNED8* pBuffer)
{
	UNSIGNED8 result = 0;

	TUtils::fillArray(pBuffer, TPO_ARR[0]);
	result += *(TPO_ARR[0]);

	TUtils::fillArray(pBuffer + result, TO_ARR[0]);
	result += *(TO_ARR[0]);

	TCommandParser* pParser = TCommandParser::getInstance();
	TUtils::longToAnsi(pParser->getFromSerial(), 6, pBuffer + result);
	result += 6;

	TUtils::fillArray(pBuffer + result, FROM_ARR[0]);
	result += *(FROM_ARR[0]);

	TUtils::longToAnsi(/*20*/TEEPROMHandler::getInstance()->getSerialNumber(), 6, pBuffer + result);
	result += 6;

	TUtils::fillArray(pBuffer + result, PAS_ARR[0]);
	result += *(PAS_ARR[0]);

	TUtils::longToAnsi(1111/*TEEPROMHandler::getInstance()->getPassword()*/, 4, pBuffer + result);
	result += 4;

	TUtils::fillArray(pBuffer + result, NMS_ARR[0]);
	result += *(NMS_ARR[0]);

	TUtils::longToAnsi(1, 4, pBuffer + result);
	result += 4;

	TUtils::fillArray(pBuffer + result, COMMA_ARR[0]);
	result += *(COMMA_ARR[0]);

	return result;
}

void TCommand::calcAndFillLRC(UNSIGNED8* pBuffer, UNSIGNED8 length)
{

}
